package Interface.Admin;

import Mapper.Admin.huiYuanMapper;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import liaotian.Client;

import java.io.FileInputStream;

/**
 * 主界面
 */
public class zhujiemian extends Application {

    huiYuanMapper huiYuanMapper;
    @Override
    public void start(Stage primaryStage) throws Exception {

        FileInputStream input=new FileInputStream("C:\\Users\\86178\\Videos\\0146565aab385fa80120be1469216d.jpg@2o.jpg");
        Image image = new Image(input);
        ImageView imageView =new ImageView(image);
        imageView.setFitWidth(488);
        imageView.setFitHeight(465);

        huiYuanMapper=new huiYuanMapper();

        Button huiYuan = new Button("会员管理");
        huiYuan.setOnAction(e -> huiYuan());
        Button yuanGong = new Button("员工管理");
        yuanGong.setOnAction(e->yuanGong());

        Button keCheng = new Button("课程管理");
        keCheng.setOnAction(e->keCheng());
        Button kefuchuli = new Button("客服处理");
        kefuchuli.setOnAction(e->kefuchuli());
        Button huoDongFaBu = new Button("活动发布");
        huoDongFaBu.setOnAction(e->huoDongFaBu());

        Pane pane = new Pane();
        pane.getChildren().add(imageView);
        pane.getChildren().addAll(huiYuan,yuanGong,keCheng,huoDongFaBu,kefuchuli);

        huiYuan.setLayoutX(0);
        huiYuan.setLayoutY(0);


        keCheng.setLayoutX(0);
        keCheng.setLayoutY(50);


        huoDongFaBu.setLayoutX(0);
        huoDongFaBu.setLayoutY(100);

        yuanGong.setLayoutX(0);
        yuanGong.setLayoutY(150);

        kefuchuli.setLayoutX(0);
        kefuchuli.setLayoutY(200);


        Scene scene =new Scene(pane);
        Stage stage=new Stage();
        stage.setScene(scene);
        stage.setTitle("管理端");
        stage.setWidth(500);
        stage.setHeight(500);
        stage.setResizable(false);//窗口不可拉伸
        stage.show();
    }

    private void kefuchuli() {
        liaotian.Client client =new Client();
        String name= "客服";
        liaotian.Client.nickname=name;
        client.start(new Stage());
    }

    /**
     * 活动发布
     */
    private void huoDongFaBu() {
        huoDongFaBu huoDongFaBu =new huoDongFaBu();
        try {
            huoDongFaBu.start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    /**
     * 会员办卡情况
     */
//    private void tongJiHuiYuan() {
//        tongJiHuiYuan tongJiHuiYuan =new tongJiHuiYuan();
//        try {
//            tongJiHuiYuan.start(new Stage());
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }

    /**
     * 课程管理
     */
    private void keCheng() {
        keCheng keCheng =new keCheng();
        try {
            keCheng.start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 健身器材
     */
    private void jianShenQi() {
        jianShenQi jianShenQi =new jianShenQi();
        try {
            jianShenQi.start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 员工管理
     */
    private void yuanGong() {
        yuanGong yuanGong =new yuanGong();
        try {
            yuanGong.start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 会员管理
     */
    private void huiYuan() {
       huiYuan huiYuan =new huiYuan();
        try {
            huiYuan.start(new Stage());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
